package com.example.springcloudwinter.properties;

import com.example.springcloudwinter.token.JWTPropertiesInterface;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

@Configuration
@ConfigurationProperties(prefix = "jwt")
public class JWTProperties implements JWTPropertiesInterface {

    /**
    a
     */
    public Map<String,Object> header=new HashMap<>();

    public SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;// 使用SHA256withDSA加密算法
    public String secret;

    public Long accessTokenExpiration;

    public String jwtIss;

    public String subject;

    @Override
    public Map<String, Object> getHeader() {
        return header;
    }

    public JWTProperties setHeader(Map<String, Object> header) {
        this.header = header;
        return this;
    }

    @Override
    public SignatureAlgorithm getSignatureAlgorithm() {
        return signatureAlgorithm;
    }

    public JWTProperties setSignatureAlgorithm(SignatureAlgorithm signatureAlgorithm) {
        this.signatureAlgorithm = signatureAlgorithm;
        return this;
    }

    @Override
    public String getSecret() {
        return secret;
    }

    public JWTProperties setSecret(String secret) {
        this.secret = secret;
        return this;
    }

    @Override
    public Long getAccessTokenExpiration() {
        return accessTokenExpiration;
    }

    public JWTProperties setAccessTokenExpiration(Long accessTokenExpiration) {
        this.accessTokenExpiration = accessTokenExpiration;
        return this;
    }

    @Override
    public String getJwtIss() {
        return jwtIss;
    }

    public JWTProperties setJwtIss(String jwtIss) {
        this.jwtIss = jwtIss;
        return this;
    }

    @Override
    public String getSubject() {
        return subject;
    }

    public JWTProperties setSubject(String subject) {
        this.subject = subject;
        return this;
    }
}